/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Trung
 */
public class BookingModel extends AbstractTableModel{

    ArrayList<entity.Booking> list ;
    public BookingModel(ArrayList<entity.Booking> list ){
        this.list = list;
    }
    public final static String[] columnNames = {
       "STT","Tên khách","Tên phòng","Loại phòng","Giá phòng"
    };
    public int getRowCount() {
       return list.size();
    }

    public int getColumnCount() {
        return columnNames.length;
    }

    public Object getValueAt(int row, int col) {
          switch(col){
              case 0:return row+1;            
              case 1:return list.get(row).getCustomer().getName();    
              case 2:return list.get(row).getRoom().getName();
              case 3:return list.get(row).getRoom().getRoomtype().getName();    
              case 4:return list.get(row).getRoom().getRoomtype().getCost();    
              default: return null;  
            }
    }
    public String getColumnName(int columnIndex) {
        return columnNames[columnIndex];
    }

  
}
